package com.yonyou.cyxdms.sysAuth.service.service.feign;

import com.alibaba.druid.support.json.JSONUtils;
import com.yonyou.cyx.framework.service.http.HttpRequestService;
import com.yonyou.cyx.function.bean.dto.http.RestServiceRequestDto;
import com.yonyou.cyx.function.bean.dto.http.RestServiceResponseDto;
import com.yonyou.cyxdms.sysAuth.service.constants.UserAuthConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: tanjie
 * @Description:
 * @Date: Create in 17:23 2019/7/23
 */
@Service
public class WuLinUserAuthClient {
    @Autowired
    HttpRequestService service;

    /**
     * 获取五菱用户信息
     * @param authUrl
     * @param token
     * @return
     */
    public RestServiceResponseDto getMainAppUserInfo(String authUrl, String token) {



        Map<String, String> requestHeaderParam = new HashMap<>();
        requestHeaderParam.put("cookie",UserAuthConstant.TOKEN_NAME_WULIN+"="+token);
        //定义请求对象
        RestServiceRequestDto requestDto = new RestServiceRequestDto();
        requestDto.setUrl(authUrl);
        requestDto.setHeadersParams(requestHeaderParam);

        return service.getRequest(requestDto);
    }
}
